package com.pti.usermanager.dao.impl;

import com.pti.usermanager.dao.api.UserDao;
import com.pti.usermanager.dao.mapper.UserMapper;
import com.pti.usermanager.dao.po.UserPo;
import com.pti.usermanager.web.dto.request.SaveUserRequest;
import com.pti.usermanager.web.dto.request.UpdateUserRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName: UserDaoImpl
 * @Author: liumengyao
 * @Description: 用户数据交换实现层
 * @Date: 2019/1/16
 */
@Repository
public class UserDaoImpl implements UserDao {

    private static final Logger logger = LogManager.getLogger(UserDaoImpl.class);

    @Autowired
    private UserMapper userMapper;


    @Override
    public UserPo findUserByloginNm(String loginNm) {
        return userMapper.findUserByloginNm(loginNm);
    }

    @Override
    public List<UserPo> findAll(String loginNm,String usrNm) {
        return userMapper.findAll(loginNm,usrNm);
    }

    @Override
    public UserPo findAllByUsrId(Long usrId) {
        return userMapper.findAllByUsrId(usrId);
    }

    @Override
    public void saveUser(SaveUserRequest saveUserRequest) {
        userMapper.saveUser(saveUserRequest);
    }

    @Override
    public void updateUser(UpdateUserRequest updateUserRequest) {
        userMapper.updateUser(updateUserRequest);
    }

    @Override
    public void delUser(Long usrId) {
        userMapper.delUser(usrId);
    }
}
